package com.ludomancy.breathe;

public class Tree extends RoomObject
{
	public boolean fallen = false;
	
	public Tree(int position)
	{
		super(position);
	}

	public void doTurn()
	{
		if(position == Game.game.position)
		{
			if(fallen && Game.game.cat.paralized)
			{
				Game.game.addResponse("You desperately stumble and you slip on the fallen christmas tree. The cat makes a chilling sound and then silence. You fall hard on your back, and notice that your legs are not responding anymore.");
				Game.game.addResponse("You feel the wool and the fire getting into your nostrils. Tired and sleepy.");
				Game.game.options.clear();
				Game.game.addOption(Game.win);
				Game.game.finalSequence = true;
				return;
			}
			else
			if(fallen)
			{
				Game.game.addResponse("You feel the tree's ornaments crushing beneath your feet like small skulls.");
			}
		}
	}

	public boolean isPassable()
	{
		return true;
	}

	public void onBump()
	{
		if(!fallen)
		{
			// if you are desperate and hit the tree on the right side, it falls
			if(Game.game.isDesperate() && Game.game.freeHand)
			{
				Game.game.addResponse("You bump into the christmas tree.");
				Game.game.addOption(Game.moveTree);
			}
			else
			{
				Game.game.addResponse("You bump into the christmas tree. If you weren't careful, you could have fallen.");
			}
		}
	}

	public void processOption(Option option)
	{
		if(option == Game.moveTree)
		{
			Game.game.addResponse("You desperately try to grab the christmas tree and feel it crashing somewhere around.");
			fallen = true;
			// move
			position = Game.DESK;
		}
	}
}
